home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Hardware / Mac OS USB DDK / Mac OS USB DDK 1.4.1 / Examples / MouseModule / MouseModule.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-25  |  3.0 KB  |  117 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        MouseModule.h
  3.  
  4.     Contains:    Header file for mouse module
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1997-1999 by Apple Computer, Inc., all rights reserved.
  9.  
  10. */
  11. #ifndef __MouseModuleH__
  12. #define __MouseModuleH__
  13.  
  14. #include <Types.h>
  15. #include <Devices.h>
  16. #include <DriverServices.h>
  17. #include <Processes.h>
  18. #include <CursorDevices.h>
  19. #include <USB.h>
  20.  
  21. #if UNIVERSAL_INTERFACES_VERSION <= 0x0330
  22.     // the following were not defined in UI&L 3.3 nor in USB.h 1.4 and will generate compiler 
  23.     // errors 
  24. enum {
  25.     kUSBPortDisabled =    -6969
  26. };
  27. #endif
  28.  
  29. #define kMouseModuleName    "\pUSBHIDMouseModule"
  30.  
  31. Boolean    immediateError(OSStatus err);
  32. void     InitParamBlock(USBReference theInterfaceRef, USBPB * paramblock);
  33. void     MouseInitiateTransaction(USBPB *pb);
  34. void     MouseCompletionProc(USBPB *pb);
  35. void     WatchDogCompletionProc(USBPB *pb);
  36. void    InterfaceEntry(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterfaceDescriptor, USBDeviceDescriptorPtr pDeviceDescriptor, USBDeviceRef device);
  37. void     ChainJADBProc(void);
  38. void     UnchainJADBProc(void);
  39.  
  40. static     OSStatus    MouseDeviceInitialize(USBDeviceRef device, USBDeviceDescriptorPtr pDesc, UInt32 busPowerAvailable);
  41. static     OSStatus    MouseInterfaceInitialize(UInt32 interfacenum, USBInterfaceDescriptorPtr pInterface, USBDeviceDescriptorPtr pDesc, USBDeviceRef device);
  42. static     OSStatus    MouseModuleFinalize(USBDeviceRef theDeviceRef, USBDeviceDescriptorPtr pDesc);
  43.  
  44. OSStatus USBHIDControlDevice(UInt32 theControlSelector, void * theControlData);
  45. void NotifyRegisteredHIDUser(UInt32 refcon, UInt32 reportSize, void * theReport, USBReference theInterfaceRef);
  46.  
  47. void     USBMouseIn(UInt32 refcon, void * theData);
  48.  
  49. #define kMouseRetryCount    3
  50.  
  51. enum driverstages
  52. {  
  53.     kUndefined = 0,
  54.     kSetProtocol,
  55.     kSetIdleRequest,
  56.     kConfigureInterface,
  57.     kSetRemoteWakeup,
  58.     kFindPipe,
  59.     kReadInterruptPipe,
  60.     kGetPortStatus,
  61.     kResetMouse,
  62.     kResetMouseDelay,
  63.     kPortStatusDelay,
  64.     kReturnFromDriver =     0x1000,
  65.     kRetryTransaction =     0x2000,
  66.     kCompletionInProgess =     0x4000,
  67.     kCompletionPending =     0x8000,
  68.     kStageMask =             0x00ff
  69. };
  70.  
  71. enum watchdogstates
  72. {
  73.     kDelay10Seconds = 1,
  74.     kCheckForAbort
  75. };
  76.  
  77. typedef struct
  78. {
  79.     USBPB                             pb;
  80.     void (*handler)(USBPB             *pb);
  81.     
  82.     Boolean                            intPipeAborted;
  83.     Boolean                            driverRemovalPending;
  84.     
  85.     Boolean                            watchDogActivityFlag;
  86.     Boolean                            watchDogAbortFlag;
  87.     UInt32                            watchDogState;
  88.  
  89.     USBReference                    interfaceRef;
  90.     USBPipeRef                        pipeRef;
  91.     
  92.     USBDeviceDescriptor             deviceDescriptor;
  93.     USBInterfaceDescriptor            interfaceDescriptor;
  94.  
  95.     UInt32                            hidDeviceType;
  96.     UInt8                            hidReport[64];
  97.     UInt32                            maxPacketSize;
  98.     
  99.     HIDInterruptProcPtr             pSHIMInterruptRoutine;
  100.     HIDInterruptProcPtr             pSavedInterruptRoutine;
  101.     
  102.     UInt32                            interruptRefcon;
  103.     
  104.     HIDNotificationProcPtr             pNotificationRoutine;
  105.     UInt32                            notificationRefcon;
  106.     
  107.     SInt32                             retryCount;
  108.     SInt32                            transDepth;
  109.     
  110.     CursorDevicePtr                    pCursorDeviceInfo;
  111.     CursorDevice                    cursorDeviceInfo;
  112.     Fixed                            unitsPerInch;
  113.     
  114.     UInt32                            previousState;    // For port status check resume
  115. } usbMousePBStruct;
  116.  
  117. #endif //__MouseModuleH__